package com.kgc.dao.mapper.user;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.jdbc.SQL;

/**
 * @author hyj
 * @time 2024/4/3 8:31
 * @describe
 */

public class SqlProvide {
    public String updateOwner(@Param("id") Integer id, @Param("username") String username, @Param("email") String email) {
        return new SQL() {{
            UPDATE("users");
            if (username != null && !"".equals(username)) {
                SET("username=#{username}");
            }
            if (email != null && !"".equals(email)) {
                SET("email=#{email}");
            }
            WHERE("user_id=#{id}");
        }}.toString();
    }
}
